﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CoolEngine.Gui;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace CoolEngine.Engine.Graphics
{
    public class WorldInterface : GameScreen
    {
        public Camera Camera { get; set; }
        public SceneGraph Scene { get; set; }
        private Texture2D whiteDot;
        //public WorldInterface()
        //{
        //    DrawOrder = Int32.MinValue;
        //}
        public WorldInterface(Camera camera, CoolGame game, GuiRenderer renderer)
            : base(game, renderer, GameMenuControl.Instance)
        {
            Camera = camera;
            DrawOrder = Int32.MinValue;
            Scene = new SceneGraph(game);
        }
        public override void Initialize()
        {
            whiteDot = Game.Content.Load<Texture2D>("Textures\\WhiteDot");
            Variables.RegisterControl("renderer", this);
            base.Initialize();
        }
        public override bool CaptureMouse
        {
            get
            {
                return !ConsoleWindow.Instance.Visible;
            }
        }
        public override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Fuchsia);
            //var models = from model in Scene.Models
            //             where model.//.CanBeSeen(Camera.Frustum)
            //             select model;
            //foreach (Model model in models)
            //{
            //    model.Draw(gameTime);
            //}

            if (Camera.Tint != Color.White)
            {
                
                Batch.Draw(whiteDot, DrawLocation, Camera.Tint);
                
            }
            base.Draw(gameTime);
        }
    }
}
